package com.example.demo.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class JDKInvocation implements InvocationHandler {


    //被代理对象
    private Object target;

    public JDKInvocation(Object target) {
        this.target = target;
    }


    @Override
    //执行目标方法
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("我开始代理");
        Object invoke=method.invoke(target,args);
        System.out.println("我结束代理");
        return null;
    }
}
